#include<stdio.h>
#include <stdlib.h>
#define MaxSize 100
typedef struct {
    int N;
    char A;
    char B;
    char C;
}ElementType;
typedef struct {
    ElementType Data[MaxSize];
    int top;
}Stack;
void Push(Stack* PtrS, ElementType item) {
    if (PtrS->top == MaxSize)
    {
        printf("The stack is full!\n");
        return;
    }
    else
    {
        PtrS->Data[++(PtrS->top)] = item;
        return;
    }
}
ElementType Pop(Stack* PtrS) {
    if (PtrS->top == -1)
    {
        printf("The stack is empty!\n");
        exit(1);
    }
    else
    {
        PtrS->top--;
        return (PtrS->Data[PtrS->top + 1]);
    }
}
void Hanoi(int n) {
    ElementType P, toPush;
    Stack S;

    P.N = n; P.A = 'a'; P.B = 'b'; P.C = 'c';
    S.top = -1;

    Push(&S, P);
    while (S.top != -1)
    {
        P = Pop(&S);
        if (P.N == 1)
            printf("%c -> %c\n", P.A, P.C);
        else
        {
            toPush.N = P.N - 1;
            toPush.A = P.B; toPush.B = P.A; toPush.C = P.C;
            Push(&S, toPush);
            toPush.N = 1;
            toPush.A = P.A; toPush.B = P.B; toPush.C = P.C;
            Push(&S, toPush);
            toPush.N = P.N - 1;
            toPush.A = P.A; toPush.B = P.C; toPush.C = P.B;
            Push(&S, toPush);
        }
    }
}
int main() {
    int n;
    scanf("%d", &n);
    if (n <= 0)return 0;
    else Hanoi(n);
}
